PROJECTROOT=..

.PHONY: clean test

include $(PROJECTROOT)/common.in

TARGET=microtest
TARGETWITHPATH=./$(TARGET)

INCDIR+=-I$(SPACE)./
INCDIR+=-I$(SPACE)../include
INCDIR+=-I$(SPACE)./cmockery/google

CFLAGS+=-DHAVE_CONFIG_H

SOURCE=$(shell find . -maxdepth 1 -name "*.c")
SOURCE+=cmockery/cmockery.c
OBJECT=$(subst .c,.o, $(SOURCE))

EXTLIBS+=$(PROJECTROOT)/$(BUILDDIR)/librefobject.a

all: test

test: $(TARGETWITHPATH)
	$(TARGETWITHPATH)

$(TARGETWITHPATH): $(OBJECT) $(EXTLIBS)
	@echo "@ linking $@"
	$(CC) $(CFLAGS) $(STRIP) $(OBJECT) $(LIBS) $(EXTLIBS) -o $@

clean:
	$(RM) -f $(OBJECT)
	$(RM) -f $(TARGETWITHPATH)
	$(RM) -f *~

depend:
	$(RM) -f depend.inc
	$(CC) $(INCDIR) -MM $(SOURCE) > depend.inc

echo_source:
	@echo $(SOURCE)

include depend.inc
